const query = require('./index')

class UserModel {
  constructor () {

  }
  
  // user_selectData_by_id
  static user_selectData_by_id (values) {
    const _sql = `SELECT * FROM user WHERE id = ?`
    return query(_sql, values)
  }
//用户名查询
  static user_select_by_username (values) {
    const _sql = `SELECT ?? FROM user WHERE username = ?`
    return query(_sql, values)
  }
  static credential_insert (values) {
    const _sql = `INSERT INTO zs_list SET ?`
    return query(_sql, values)
  };

  static user_updata(values){
    const _sql = "update user set password= '" + values.password + "' where username= '" + values.username + "'"
    return query(_sql, values)
  };

  static user_delete_by_id (values) {
    const _sql = 'DELETE FROM user WHERE id = ' + values
    return query(_sql, values)
  }
  
  static user_selectadmin_by_username (values) {
    const _sql = `SELECT ?? FROM admin_ WHERE username = ?`
    return query(_sql, values)
  }
  
}


module.exports = UserModel